package judlawei.gui;

import java.io.File;

import javax.swing.GroupLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import judlawei.readfile.Reader;

public class VisualizadorDocOrig extends JPanel{

    private JScrollPane jScrollPane1;
    private JLabel DocOrig;
    private JTextArea textDocOrig;

    public VisualizadorDocOrig(){
        initComponents();
        construirLayout();
        
    }
    
    private void initComponents(){
        
        DocOrig = new JLabel();
        jScrollPane1 = new JScrollPane();
        textDocOrig = new JTextArea();
        
        DocOrig.setText("Documento Original:");
        textDocOrig.setColumns(20);
        textDocOrig.setRows(5);
        textDocOrig.setEditable(false);
        jScrollPane1.setViewportView(textDocOrig);
    }
    
    private void construirLayout(){
        
        GroupLayout VisualizadorDocOrigLayout = new GroupLayout(this);
        this.setLayout(VisualizadorDocOrigLayout);
        VisualizadorDocOrigLayout.setHorizontalGroup(
            VisualizadorDocOrigLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(VisualizadorDocOrigLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(VisualizadorDocOrigLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 789, Short.MAX_VALUE)
                    .addComponent(DocOrig))
                .addContainerGap())
        );
        VisualizadorDocOrigLayout.setVerticalGroup(
            VisualizadorDocOrigLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(GroupLayout.Alignment.TRAILING, VisualizadorDocOrigLayout.createSequentialGroup()
                .addContainerGap(43, Short.MAX_VALUE)
                .addComponent(DocOrig)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 264, GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }
 
    
    public void inserirTexto(File f){
        Reader reader = Reader.getInstance();
        textDocOrig.setText(reader.getText(f));
    }
    
    
    
}